﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JiuQianTS_ZJ.aspx.cs" Inherits="Web.Pages.QuShui.DiXiaS.ShouFeiGL.JiuQianTS_ZJ"  Theme="Default" %>

<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../../../css/inputBgColor.css" rel="stylesheet" />
    <script src="../../../../JS/AddEditCancel.js"></script>
    <script type="text/javascript">

        function SearchData() {
            if (event.keyCode == 13) {
                if (txtYongHuH.GetText() == "") {
                    alert("请输入用户号！");
                    txtYongHuH.Focus();
                    return;
                }
                if (txtYongHuH.GetText().length != 7) {
                    alert("用户号应为7位");
                    txtYongHuH.Focus();
                    return;
                }
                
                if (txtYM.GetText().length != 6) {
                    alert("请输入正确的水量年月(示例:201709)");
                    txtYM.Focus();
                    return;
                }

                ASPxCallback1.PerformCallback("search");
               
            }
        }


        function add() {
            ASPxCallback1.PerformCallback("SaveData");
        }



        function ASPxCallback1Complete(rs) {
            var arr = rs.split('|');
            var type = arr[0];
            var state = arr[1];
            if (type == "search") {
                if (arr[2] == '0') {
                    alert('此用户在当前水量年月下没有欠费！');
                }
                else {
                    txtJinE.SetText(arr[3]);
                    txtKaiHuHM.SetText(arr[4]);
                    txtKaiHuZH.SetText(arr[5]);
                    txtKaiHuYH.SetText(arr[6]);
                   
                }
            }
            else if (type == "SaveData") {

                if (arr[2]=='1') {
                    alert('添加成功！');
                    var zbs = txtZongBiS.GetText() == '' ? 0 : parseInt(txtZongBiS.GetText());
                    txtZongBiS.SetText(zbs + 1);
                    var zje = txtZongJinE.GetText() == '' ? 0 : parseFloat(txtZongJinE.GetText());
                    txtZongJinE.SetText(zje + parseFloat(txtJinE.GetText()));

                    txtJinE.SetText("");
                    txtKaiHuHM.SetText("");
                    txtKaiHuZH.SetText("");
                    txtKaiHuYH.SetText("");
                    txtYongHuH.SetText("");
                    txtYM.SetText("");
                    txtYongHuH.Focus();
                }
                else {
                    alert(arr[2]);
                }

            }
        }

        window.onunload = function () {
            try {
                var open = window.opener;    //第三方跨域
                open.reLoad();
            } catch (error) {

            }

        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="updatePanel1" runat="server">
            <ContentTemplate>
                <dx:ASPxHiddenField ID="hdCollection" ClientInstanceName="hdCollection" runat="server"></dx:ASPxHiddenField>
        <dx:ASPxCallback ID="ASPxCallback1" ClientInstanceName="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback" ClientSideEvents-CallbackComplete="function(s,e){ASPxCallback1Complete(e.result);}"></dx:ASPxCallback>
        <%--<dx:ASPxLoadingPanel ID="ASPxLoadingPanel1" ClientInstanceName="LoadPanel" runat="server"></dx:ASPxLoadingPanel>--%>

                <div style="margin: auto; width: 98%">
                    <div class="tabletitle1" align="center">
                        增加旧欠托收明细
                    </div>
                    <div>
                        <div>
                            <table style="height:270px;">
                                <tr>
                                    <td>进帐单编号：</td>
                                    <td>
                                        <dx:ASPxTextBox ID="txtShouFeiBH" ClientInstanceName="txtShouFeiBH" runat="server" Width="70%" ClientEnabled="false"></dx:ASPxTextBox>
                                    </td>
                                    <td align="right">总笔数：</td>
                                    <td>
                                        <dx:ASPxTextBox ID="txtZongBiS" ClientInstanceName="txtZongBiS" runat="server" Width="120px" ClientEnabled="false"></dx:ASPxTextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">总金额：</td>
                                    <td>
                                        <dx:ASPxTextBox ID="txtZongJinE" ClientInstanceName="txtZongJinE" runat="server" Width="120px" ClientEnabled="false" DisplayFormatString="0.00"></dx:ASPxTextBox>
                                    </td>
                                </tr>
                               
                                <tr>
                                    <td align="right">
                                        <span>收费类型：</span>
                                    </td>
                                    <td>
                                        <dx:ASPxComboBox ID="cmbSFLX" ClientInstanceName="cmbSFLX" runat="server" ClientEnabled="true" Width="120px">
                                            <Items>
                                                <dx:ListEditItem Text="开采水费" Value="1"  Selected="true"/>
                                                <dx:ListEditItem Text="加价水费" Value="2" />
                                                <dx:ListEditItem Text="采灌补收水费" Value="3" />
                                            </Items>
                                        </dx:ASPxComboBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">用户号：
                                    </td>
                                    <td>
                                        <dx:ASPxTextBox ID="txtYongHuH" ClientInstanceName="txtYongHuH" runat="server" Width="100%">
                                            <ClientSideEvents KeyUp="function(s,e){inputNum(s);}" KeyPress="function(s,e){OnKeyNext(txtYM);}"/>
                                        </dx:ASPxTextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">水量年月：
                                    </td>
                                    <td>
                                        <dx:ASPxTextBox ID="txtYM" ClientInstanceName="txtYM" runat="server" Width="100%">
                                            <ClientSideEvents KeyUp="function(s,e){inputNum(s);ymSearch();}" KeyPress="function(s,e){SearchData();}" />
                                        </dx:ASPxTextBox>
                                    </td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td align="right">金额：
                                    </td>
                                    <td>
                                        <dx:ASPxTextBox ID="txtJinE" ClientInstanceName="txtJinE" runat="server" Width="100%" HorizontalAlign="Right"  ClientEnabled="false" DisplayFormatString="0.00"></dx:ASPxTextBox>
                                    </td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td align="right">开户户名：
                                    </td>
                                    <td colspan="3">
                                        <dx:ASPxTextBox ID="txtKaiHuHM" ClientInstanceName="txtKaiHuHM" runat="server" Width="100%" ClientEnabled="false"></dx:ASPxTextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">银行账号：
                                    </td>
                                    <td colspan="3">
                                        <dx:ASPxTextBox ID="txtKaiHuZH" ClientInstanceName="txtKaiHuZH" runat="server" Width="100%" ClientEnabled="false"></dx:ASPxTextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">开户银行：
                                    </td>
                                    <td colspan="3">
                                        <dx:ASPxTextBox ID="txtKaiHuYH" ClientInstanceName="txtKaiHuYH" runat="server" Width="100%" ClientEnabled="false"></dx:ASPxTextBox>
                                    </td>
                                </tr>
                            </table>
                           
                            <div>
                                <table style="width: 100%;">
                                    <tr>
                                        <td align="center">
                                            <hr />
                                            <dx:ASPxButton ID="btnAdd" runat="server" Text="增加" UseSubmitBehavior="false" AutoPostBack="false" ClientSideEvents-Click="function(s,e){add();}"></dx:ASPxButton>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>

                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>